package org.spider.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.spider.model.entity.SpiderAuthUserEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.spider.user.entity.User;
import org.spider.user.excel.UserExcel;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lzy
 * @since 2022-06-17 09:39:16
 */
@Mapper
public interface SpiderAuthUserMapper extends BaseMapper<SpiderAuthUserEntity> {

    /**
     * 自定义分页
     *
     * @param page
     * @param user
     * @return
     */
    List<User> selectUserPage(IPage page, User user);

    /**
     * 获取用户
     *
     * @param tenantId
     * @param account
     * @param password
     * @return
     */
    @Select("SELECT * FROM spider_auth_user WHERE tenant_id = #{tenantId} and user_account = #{account} and user_password = #{password} and user_status = 2")
    SpiderAuthUserEntity getUser(String tenantId, String account, String password);

    /**
     * 获取角色名
     *
     * @param ids
     * @return
     */
    List<String> getRoleName(String[] ids);

    /**
     * 获取角色别名
     *
     * @param ids
     * @return
     */
    List<String> getRoleAlias(String[] ids);

    /**
     * 获取部门名
     *
     * @param ids
     * @return
     */
    List<String> getDeptName(String[] ids);

    /**
     * 获取导出用户数据
     *
     * @param queryWrapper
     * @return
     */
    List<UserExcel> exportUser(@Param("ew") Wrapper<User> queryWrapper);
}
